# -*- coding:utf-8 -*-
import sys
import datetime
import smtplib
from email.mime.text import MIMEText

reload(sys)
sys.setdefaultencoding('utf8')

def send_mail(text):
    """
    将报告发送邮件
    """
    sender = "data@hualala.com"
    receiver = [
                'lixiyong@hualala.com'         # 李锡永
                ]
    # text html plain
    msg = MIMEText(text, 'html', 'utf-8')
    msg['From'] = sender
    msg['To'] = ','.join(receiver)
    msg['Subject'] = 'BCP数据质量日报'
    local_from_addr = 'bigdata-alarm@hualala.com'
    smtp = smtplib.SMTP('smtp.hualala.com', 25)
    smtp.login(local_from_addr, 'Hllmon@123')
    smtp.sendmail(local_from_addr, receiver, msg.as_string())
    smtp.quit()

if __name__ == '__main__':
    content = "test"
    send_mail(content)
